<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body, html {width: 100%;height: 100%; margin:0;font-family:"微软雅黑";}
        #l-map{height:60%;width:100%;}
        #r-result,#r-result table{width:100%;}
        #main div{
            float:left;
			width:33%;
			height:30px;
            line-height:30px;
            text-align:center;
            border-right: 1px solid;
        }
        a:link{
            text-decoration:none;
        }
        .clo{
            border-right: 2px solid #666;
        }
        #r-result h1{
            background:#EBF1FB;
        }
        #main{
            overflow: hidden;
        }
        #car{
            background:#86b7fe;
        }
    </style>
    <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
    <script type="text/javascript" src="js/jquery.params.js"></script>
    <script type="text/javascript" src="js/rootPath.js"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=egEvcrdvoxPAv64b4FWl7V867zzmPTxZ"></script>
    <title>步行</title>
</head>
<body>
<div id="l-map"></div>
<div id="main">
    <div class="clo" ><a href="map1.html">公交</a></div>
    <div class="clo" id="car"><a href="map2.html">步行</a></div>
    <div class="clo"><a href="map3.html">骑行</a></div>
</div>
<div id="r-result"></div>
</body>
</html>
<script type="text/javascript">
        var destLng = $.query.get("destLng");
        var destLat = $.query.get("destLat");
        // $(this).attr('href')
        $("a").eq(0).attr("href",$("a").eq(0).attr("href")+"?destLng="+destLng+"&destLat="+destLat);
        $("a").eq(1).attr("href",$("a").eq(1).attr("href")+"?destLng="+destLng+"&destLat="+destLat);
        $("a").eq(2).attr("href",$("a").eq(2).attr("href")+"?destLng="+destLng+"&destLat="+destLat);
        // 百度地图API功能
        //创建地图实例
        var map = new BMap.Map("l-map");
        //创建点坐标,初始化地图，设置中心点坐标和地图级别
        map.centerAndZoom(new BMap.Point(118.102857, 24.577551), 12);
        //定位并获取坐标
        var geolocation = new BMap.Geolocation();
        geolocation.getCurrentPosition(function(r){
            if(this.getStatus() == BMAP_STATUS_SUCCESS){
                var mk = new BMap.Marker(r.point);
                map.addOverlay(mk);
                map.panTo(r.point);
                //p1 获取的定位坐标
                p1=new BMap.Point(r.point.lng,r.point.lat);
                var end = new BMap.Point(destLng, destLat);
                //公交路线
                // var transit = new BMap.TransitRoute(map, {
                //     renderOptions: {map: map, panel: "r-result"}
                // });
                // transit.search(p1, end);
                //驾车路线
                //var driving = new BMap.DrivingRoute(map, {renderOptions: {map: map, panel: "r-result", autoViewport: true}});
                // driving.search(p1, "魏公村");
                //步行路线
                var walking = new BMap.WalkingRoute(map, {renderOptions: {map: map, panel: "r-result", autoViewport: true}});
                walking.search(p1, end);
            }
            else {
                alert('failed'+this.getStatus());
            }
        },{enableHighAccuracy: true});
</script>
<script src="js/getBackController.js"></script>